--global singleton holding all global state.
setfenv(1, require'winapi.oo')
require'winapi.oo.object'
require'winapi.router'
require'winapi.wm'

App = class(Object)

local function NameGenerator(format)
	local n = 0
	return function()
		n = n + 1
		return format % n
	end
end

function App:init()
	self.router = Router()
	self.gen_classname = NameGenerator'Frame_%d'
end

function App:run()
	return MessageLoop()
end


App:init()


if not ... then
PostQuitMessage(-1)
local exitcode = App:run()
assert(exitcode == -1)
os.exit(exitcode)
end

